import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

public class Demo03 {
    public static void main(String[] args) {
        List<String> arrayList = new ArrayList<>();
        arrayList.add("element7");
        arrayList.add("element1");
        arrayList.add("element4");
        arrayList.add("element2");
        arrayList.add("element5");
        arrayList.add("element3");
        ListIterator<String> iterator1=arrayList.listIterator();
        while(iterator1.hasNext()){
            System.out.println(iterator1.previousIndex()+"::"+iterator1.next()+"::"+iterator1.nextIndex());

    }
        System.out.println("=================");
        while(iterator1.hasPrevious()){
            System.out.println(iterator1.previous());
}
        System.out.println("=================");
        ListIterator<String> iterator=arrayList.listIterator(2);
        while(iterator.hasNext()){
            String element=iterator.next();
            System.out.println(element);
        }
    }
            }
